﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StuManager
{
    public partial class ScFrm : Form
    {
        private Context.MyContext ctx = new Context.MyContext();

        public ScFrm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var list = ctx.Vscs.ToList();
            dataGridView1.DataSource = list;
        }

        private void btnUpdate_Click(object sender, EventArgs e)
        {
            //MessageBox.Show(curStuNo + "," + curCourseNo);

            //通过构造函数传递信息给ScoreFrm
            ScoreFrm frm = new ScoreFrm(curStuNo, curCourseNo);
            frm.ShowDialog();
        }

        String curStuNo;//当前被选中行的学生学号
        String curCourseNo;
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            curStuNo = dataGridView1.Rows[e.RowIndex].Cells["StuNo"].Value.ToString();
            curCourseNo = dataGridView1.Rows[e.RowIndex].Cells["CourseNo"].Value.ToString();
        }
    }
}
